package com.ctgu.tengyun.domain;

import com.ctgu.tengyun.exception.ConvertException;

public enum SaleOrderStatus implements HasDefaultInterface<SaleOrderStatus>{

    unknown(-1),
    init(1),            //初始化
    in_stock(2),        //备货中
    shipped(3),        //已发货
    executed(4),        //已执行
    cancelled(5),        //已取消
    ;

    private Integer value;

    SaleOrderStatus(Integer value) {
        this.value = value;
    }

    @Override
    public SaleOrderStatus getDefault() {
        return unknown;
    }

    @Override
    public Integer getValue() {
        return this.value;
    }

    public static SaleOrderStatus valueOf(Integer value){
        for (SaleOrderStatus item: SaleOrderStatus.values()){
            if (item.getValue().equals(value)){
                return item;
            }
        }

        throw new ConvertException("unknown SaleOrderStatus. status:" + value);
    }

}